package com.example.demo.util;

import lombok.extern.slf4j.Slf4j;

@Slf4j

public class HotSwap {

    int version = 2;

    public void sayHello(){
        log.info("HotSwap: hello, version {}, class loader: {}", version, getClass().getClassLoader().getName());
        //用的顶级类加载器加载
        log.info("object loader: {}", new Object().getClass().getClassLoader());
        //UsedByNew用的类加载跟HotSwap一样，即MyClassLoader
        new UsedByNew().sayHello();
    }
}
